/*
 * system.h
 *
 * Created: 12.01.2014 15:23:16
 *  Author: Vladislav
 */ 


#ifndef SYSTEM_H_
#define SYSTEM_H_

#define STR_LEN 20
#define NUM_STRS 4
#define SOUND_BUF_LEN 16
#define DOOR_FAULT_NONE 2

//#include <includes.h>
#include "message_buf.h"

typedef struct  
{
	uint8_t num_events;
	uint8_t time;
	char str[NUM_STRS][STR_LEN];
	
}DisplayEvent;

//typedef struct
//{
	//uint8_t num_events;
	//uint8_t num_repeats;
	//uint8_t sounds[SOUND_BUF_LEN];
//}SoundEvent;
typedef struct _SoundEvent
{
	void* list;
	OS_EVENT* event;
}SoundEvent;

typedef struct
{
	uint8_t  mode;
	uint16_t alarm_count ;
	uint16_t msg_count;
	bool  manual;
	bool display_sleep;
	bool door_open;
	uint8_t door_fault;
	bool sys_faults;
	bool net_faults;
}System;

CAN_MSG qmsg[30];
OS_EVENT* cqmsg;

#define EVENTS_BUF_LEN 20
#define SYS_MODE_FAULT 0
#define SYS_MODE_ALARM 1
#define SYS_MODE_FIRE  2
#define SYS_MODE_ARCH  3
#define SYS_MODE_EMPTY 4


void KeyboardTask(void *p_arg);
void MessageSorterTask(void *p_arg);
void MessageProcessorTask(void *p_arg);
void DisplayTask(void *p_arg);
void SoundTask(void *p_arg);
void FireCountdownTask(void* parg);
void SysStart(void);
void FireStartTask(void* parg);
void SoundCheckTask(void* parg);




	




#endif /* SYSTEM_H_ */